﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>选择字段</title>

    <script src="/Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    <style type="text/css" >
        table,td,th{border:1px solid #ace;border-collapse:collapse ;}
        table{width:100%;}
    </style>

    <script type="text/javascript">
        var TabInfo = [{ TableName: "AAA", DataFields: [{ DataField: "AAA", Caption: "AAA" }, { DataField: "BBBB", Caption: "BBBB"}]}];

        $(function() {
            var tablename = "AAA";
            var html = [];
            for (var i = 0; i < TabInfo.length; i++) {
                var row = TabInfo[i];
                if (row["TableName"] == tablename) {
                    html.push("<table>");
                    html.push("<thead>");
                    html.push("<tr>");
                    html.push("<th>标题</th><th>字段名</th>");
                    html.push("</tr>");
                    html.push("</thead>");
                    html.push("<tbody>");
                    for (var j = 0; j < row.DataFields.length; j++) {
                        html.push("<tr>");
                        html.push("<td>" + row.DataFields[j]["Caption"] + "</td>");
                        html.push("<td>" + row.DataFields[j]["DataField"] + "</td>");
                        html.push("</tr>");
                    }
                    html.push("</tbody>");
                    html.push("</table>");
                }
            }
            $("#treegrid").html(html.join(""));
        });
    </script>

</head>
<body style="padding:0;margin:0;">
    <div id="treegrid">
    </div>
    <div id="buttonlist">
    <input type="button" value="确定" id="btnok" />
    <input type="button" value="取消" id="btncancel" />
    </div>
</body>
</html>
